-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure FileNode.data is initialized in __init__ and is not used if it… #20
base: main
Are you sure you want to change the base?
Conversation
Thank you for the PR. Can you please give me a sample file so I can test it? |
Unfortunately I can't share the sample that caused the error because it contains client data. I can share that the FileNode that caused the error had an invalid FileNodeID, and a BaseType of 2. The file actually has several FileNodes with invalid FileNodeIDs so fixing this issue probably wouldn't allow the file to be parsed correctly, but it would allow the constructor to complete. That would let the partially parsed results be inspected. Another option would be to raise an error with a meaningful error message on an invalid id, if returning a best approximation on a parsing failure isn't a project goal. Let me see if I can find anything more useful about the file to share. |
The underlying issue could stem from parsing errors in the parent nodes. Without access to the actual file, identifying the precise location of these errors would be challenging. Alternatively, you can enable DEBUG mode and share the output with me; this might give more context. |
Here is the DEBUG mode log:
The first issue seems to be that GlobalIdTableStartFNDX isn't implemented. Since it has a reserved data byte that isn't being read, the following FileNodes are offset by one byte and become invalid. Fixing that (and GlobalIdTableEntry3FNDX) gives the following debug information:
Which is better but the GlobalIdTables still seem like they are followed by junk/uninterpretable data. Which they might be, the file is wrong in a couple ways, notably that it is a .one and not a .onetoc2 file per |
I've updated the request with the changes that allow the onetoc2 GlobalIdTable to be parsed without missalignment. |
In a few days, I will check the file format reference and merge if I couldn't find an issue. Thanks for all of your efforts on this |
You're welcome. Thank you for the interest. |
… is None.
Currently if the file_node_type is not handled data is uninitialized and can cause an AttributeError.